﻿#coding=utf-8

import time

TextReplyTpl = \
    u"""
    <xml>
    <ToUserName><![CDATA[%s]]></ToUserName>
    <FromUserName><![CDATA[%s]]></FromUserName>
    <CreateTime>%s</CreateTime>
    <MsgType><![CDATA[text]]></MsgType>
    <Content><![CDATA[%s]]></Content>
    <FuncFlag>0</FuncFlag>
    </xml>
    """
def TextReply(msg, content):
    s = TextReplyTpl % (msg['FromUserName'], msg['ToUserName'], str(int(time.time())), content)
    return s

MusicReplyTpl = \
    u"""
    <xml>
    <ToUserName><![CDATA[%s]]></ToUserName>
    <FromUserName><![CDATA[%s]]></FromUserName>
    <CreateTime>%s</CreateTime>
    <MsgType><![CDATA[music]]></MsgType>
    <Music>
    <Title><![CDATA[%s]]></Title>
    <Description><![CDATA[%s]]></Description>
    <MusicUrl><![CDATA[%s]]></MusicUrl>
    <HQMusicUrl><![CDATA[%s]]></HQMusicUrl>
    </Music>
    <FuncFlag>0</FuncFlag>
    </xml>
    """
def MusicReply(msg,title,description,musicurl,hqmusicurl):
    s = MusicReplyTpl % (msg['FromUserName'], msg['ToUserName'], str(int(time.time())), title, description, musicurl, hqmusicurl)
    return s

